using System;
using System.Collections.Generic;
using SharpWind.Resources.Creators;
using SharpWind.Tools;

namespace SharpWind.Resources.Managers
{
	public sealed class MeshManager : ResourceManager<Mesh>
	{
		private Dictionary<string, Mesh> meshes = new Dictionary<string,Mesh>();
		
		internal MeshManager() : base()
		{
		}

		public Mesh Load( string name )
		{
			MeshFromFileCreator creator = new MeshFromFileCreator( Directories.Meshes + name );
			return this.Create( name, creator );
		} // Load(name)
		
		public Mesh CreateBox( string name, float width, float height, float depth )
		{
			BoxMeshCreator creator = new BoxMeshCreator( width, height, depth );
			return this.Create( name, creator );
		}

		public Mesh CreateTeapot( string name )
		{
			TeapotMeshCreator creator = new TeapotMeshCreator();
			return this.Create( name, creator );
		}

		public override Mesh this[string name]
		{
			get
			{
				return Load( name );
			}
		}
	}
}
